home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / ContextHelp.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  4.1 KB  |  165 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Nov 25 1998
  22. // 
  23. //  Description:
  24. //        Supports context sensitive menu items.
  25. //
  26. //    Procs:
  27. //      addContextHelpProc()
  28. //        removeContextHelpProc()
  29. //        doContextHelpProc()
  30. //        hasContextHelpProc()
  31. //
  32.  
  33. global proc addContextHelpProc(string $object, string $procName)
  34. //
  35. //    Description:
  36. //      addContextHelpProc - creates an array of maps 
  37. //            from the window or panel name to the
  38. //            procedure that is responsible to display 
  39. //            context sensitive help.
  40. //
  41. //    Arguments:
  42. //        $object - is the name of the panel or window.
  43. //        $procName - then name of the procedure that calls
  44. //            window or panel specific context sensitive help.
  45. //
  46. {
  47.     global string $gHelpObjectArray[];
  48.     global string $gHelpProcNameArray[];
  49.  
  50.     int $i;
  51.     int $present;
  52.     int $numItems = size($gHelpObjectArray);
  53.     
  54.     for ($i = 0; $i < $numItems; $i++)
  55.     {
  56.         if ($gHelpObjectArray[$i] == $object)
  57.         {
  58.             $present = true;
  59.             break;
  60.         }
  61.     }
  62.     
  63.     if (!$present)
  64.     {
  65.         $gHelpObjectArray[$numItems] = $object;
  66.         $gHelpProcNameArray[$numItems] = $procName;
  67.     }
  68. }
  69.  
  70. global proc removeContextHelpProc(string $object)
  71. //
  72. //    Description:
  73. //        removeContextHelpProc - removes the specified map 
  74. //            from the array.  Main usage is for plugins.
  75. //
  76. //    Arguments:
  77. //        $object - is the name of the panel or window.
  78. //
  79. {
  80.     global string $gHelpObjectArray[];
  81.     global string $gHelpProcNameArray[];
  82.  
  83.     int $i;
  84.     int $numItems = size($gHelpObjectArray);
  85.     
  86.     for ($i = 0; $i < $numItems; $i++)
  87.     {
  88.         if ($gHelpObjectArray[$i] == $object)
  89.         {
  90.             //    When context sensitive help is removed
  91.             //    for now it will be replaced by "xxxx"
  92.             //    in the array to suggest removal.
  93.             //    Later, it could be modified to properly remove the item.
  94.             //
  95.             $gHelpObjectArray[$i] = "xxxx";
  96.             $gHelpProcNameArray[$i] = "xxxx";
  97.             break;
  98.         }
  99.     }
  100. }
  101.  
  102.  
  103. global proc doContextHelpProc(string $object, string $menuParent)
  104. //
  105. //    Description:
  106. //        doContextHelpProc - given the window or panel name
  107. //            it finds the corresponding procedure and calls
  108. //            the menu's context sensitive help.
  109. //
  110. //    Arguments:
  111. //        $object - is the name of the panel or window.
  112. //        $menuParent - the parent of the menu.
  113. //
  114. {
  115.     global string $gHelpObjectArray[];
  116.     global string $gHelpProcNameArray[];
  117.  
  118.     if ($object != "" && $menuParent != "") 
  119.     {
  120.         int $i;
  121.         int $numItems = size($gHelpObjectArray);
  122.     
  123.         for ($i = 0; $i < $numItems; $i++)
  124.         {
  125.             if ($gHelpObjectArray[$i] == $object)
  126.             {
  127.                 eval ($gHelpProcNameArray[$i] + " " + $object + " " + $menuParent);
  128.                 break;
  129.             }//if
  130.         }//for
  131.     }//if
  132. }
  133.  
  134. global proc int hasContextHelpProc(string $object)
  135. //
  136. //    Description:
  137. //        hasContextHelpProc - given the window or panel name
  138. //            it checks if context help exists for that specific
  139. //            window or panel.
  140. //
  141. //    Arguments:
  142. //        $object - is the name of the panel or window.
  143. //    
  144. {
  145.     int $contextHelpExists = false;
  146.  
  147.     global string $gHelpObjectArray[];
  148.     global string $gHelpProcNameArray[];
  149.  
  150.     int $i;
  151.     int $numItems = size($gHelpObjectArray);
  152.     
  153.     for ($i = 0; $i < $numItems; $i++)
  154.     {
  155.         if ($gHelpObjectArray[$i] == $object)
  156.         {
  157.             $contextHelpExists = true;
  158.             break;
  159.         }//if
  160.     }//for
  161.     
  162.     return $contextHelpExists;
  163. }
  164.  
  165.